# 模块名和模块测试APP名称
MODULE_NAME       := hello_world_demo
# NFS 共享目录
TFTP_SERVER       ?= ~/3tftp
NFS_SERVER        ?= ~/4nfs

TFTP_DIR          ?= $(TFTP_SERVER)
ROOTFS            ?= $(NFS_SERVER)/imx6ull_rootfs

ifeq ($(KERNELRELEASE),)

# 选择可执行文件运行的平台
KERNELDIR        ?= ~/7Linux/imx6ull-kernel

PWD              := $(shell pwd)
# 编译模块和测试程序
modules:
	$(MAKE) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C $(KERNELDIR) M=$(PWD) modules

.PHONY: clean
clean:
	rm -rf  *.o  *.ko  .*.cmd  *.mod.*  modules.order  Module.symvers   .tmp_versions .cache.mk

help:
	@echo "\033[1;32m================================ Help ================================\033[0m"
	@echo "Ubuntu may need to add sudo:"
	@echo "dmesg                     # View information printed by the kernel"
	@echo "file <module_name>.ko     # View \".Ko\" file information"
	@echo "make ARCH=arm             # arm platform"
	@echo "\033[1;32m======================================================================\033[0m"

print:
	@echo "KERNELDIR = $(KERNELDIR)"

else
CONFIG_MODULE_SIG = n
obj-m            += $(MODULE_NAME).o
endif